#include <MemoryCommunication.h>
#include <stdio.h>
#include <stdlib.h> 
#include <WString.h>
#include <Debug.h>
#include <SPI.h>

uint8_t value1 = 0;
uint8_t value2 = 0;
unsigned long lastupdate = 0;
byte segmente[10] = {B0111111, B0000110,B1011011,B1001111,B1100110, B1101101,B1111101,B0000111,B11111111,B1101111};

MemoryCommunication MemoryCommunication1(&Serial1);

void setup()
{
	#if DEBUG_MODE_ON 
		while(!Serial);
	#endif

	Serial1.begin(115200);
	//debug.printf("test");
	DEBUG("STARTING...");
	DEBUG("ADRESS:\t %d",&value1);
	DEBUG("ADRESS:\t %d",&value2);

	SPI.begin();
	SPI.setBitOrder(1);
	SPI.setClockDivider(8);

}

void loop()
{
	MemoryCommunication1.loop();
	if((micros()-lastupdate) > 1000){
		lastupdate = micros();
		SPI.transfer(segmente[value1]);
		SPI.transfer(segmente[value2]);
	}
}
